import ollama
stream = ollama.generate(
    stream=True,
    model='qwen2.5:3b',
    prompt='湖水为什么是绿色的?'
)
for chunk in stream:
    if not chunk['done']:
        print(chunk['response'], end='', flush=True)


